package com.sfzd5.exam.helplibrary;

import com.sfzd5.modle.Question;

//import org.stringtemplate.v4.ST;

/*
 DoClassroomTaskOnlineActivity
 DoHomeworkOnlineActivity
 PubTaskStep4CreateExplainActivity
 StudentQuestionDetailActivity
 StudentQuestionsDetailActivity

 增加
 学生错题本
 TeacherTaskDetailActivity
 StudentFailQuestionActivity
 PubTaskStep3SelectQuestionActivity
*/
public class Generator {

    public static String generateQuestionHtml_forPanel(Question tqk) {
        StringBuilder sb = new StringBuilder();
        sb.append("<!DOCTYPE html><html><head><meta charset=\"utf-8\" /> </head> <body> <div style='width:800px'>");
        sb.append(generateQuestionHtml_forPanelOnlyQuestion(tqk));
        sb.append("</div></body></html>");
        return sb.toString();
    }

    public static String generateQuestionHtml_forPanelOnlyQuestion(Question tqk) {
        StringBuilder sb = new StringBuilder();
        //加入对子问题的支持
        sb.append("<div>").append(tqk.question_text).append("</div>");
        if(tqk.child!=null){
            for(Question q : tqk.child){
                sb.append("<div>").append(q.question_text).append("</div>");
            }
        }
        return sb.toString();
    }
}
